package bean09;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class SecondaryLinkage {
    public static void main(String[] args) {

        Map<String, List<String>> provinceCityMap = new HashMap<>();

        List<String> shanghaiCities = new ArrayList<>();
        shanghaiCities.add("黄浦区");
        shanghaiCities.add("徐汇区");
        shanghaiCities.add("长宁区");
        shanghaiCities.add("静安区");
        shanghaiCities.add("普陀区");
        shanghaiCities.add("虹口区");
        shanghaiCities.add("杨浦区");
        shanghaiCities.add("闵行区");
        shanghaiCities.add("宝山区");
        shanghaiCities.add("嘉定区");
        shanghaiCities.add("浦东新区");
        shanghaiCities.add("金山区");
        shanghaiCities.add("松江区");
        shanghaiCities.add("青浦区");
        shanghaiCities.add("奉贤区");
        shanghaiCities.add("崇明区");
        provinceCityMap.put("上海", shanghaiCities);

        Scanner scanner = new Scanner(System.in);
        System.out.println("请选择你所在的省份：");
        for (String province : provinceCityMap.keySet()) {
            System.out.println(province);
        }
        String selectedProvince = scanner.nextLine();

        if (provinceCityMap.containsKey(selectedProvince)) {
            System.out.println("请选择你所在的城市：");
            for (String city : provinceCityMap.get(selectedProvince)) {
                System.out.println(city);
            }
        } else {
            System.out.println("未找到对应省份的城市。");
        }
    }
}